package Composite;

import java.util.ArrayList;
import java.util.List;

public class Department extends AbstractDepartment{
	private List<AbstractDepartment> subDepartments;
	private String departmentName;
	public Department(String name){
		subDepartments = new ArrayList<AbstractDepartment>();
		departmentName = name;
		
	}
	@Override
	public void add(AbstractDepartment de){
		subDepartments.add(de);
	}
	@Override
	public void remove(AbstractDepartment de){
		subDepartments.remove(de);
	}
	@Override
	public void display(){

		System.out.println(departmentName);
		for(AbstractDepartment ad:subDepartments){
			ad.display();
		}
			
	}

}
